package operation;

import book.Book;
import book.BookList;

import java.util.Scanner;

public class add implements IOperation {

    @Override
    public void work(BookList bookList) {
        System.out.println("添加图书");
        Scanner scan=new Scanner(System.in);
        System.out.println("请输入书名");
        String name = scan.nextLine();
        System.out.println("请输入作者");
        String author = scan.nextLine();
        System.out.println("请输入价格");
        int price = scan.nextInt();
        String s = scan.nextLine();
        System.out.println("请输入类型");
        String type = scan.nextLine();

        Book book=new Book(name,author,price,type);
        int currentsize = bookList.getUserSize();

        bookList.setBooks(currentsize,book);
        bookList.setUserSize(currentsize+1);
        System.out.println("添加成功!");
    }
}
